<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<%@ taglib prefix="l" uri="/WEB-INF/struts-logic.tld"%>

<%@ taglib uri="/WEB-INF/hexacta.tld" prefix="hexacta"%>

<head>
<sx:head cache="true" />
<link rel="stylesheet" href="/hrs-intranet/styles/errortag.css"
	type="text/css" />
<link rel="stylesheet" href="/hrs-intranet/styles/TabContainerLocal.css"
	type="text/css" />
<link rel="stylesheet" href="/hrs-intranet/styles/displaytag.css"
	type="text/css" />
<link rel="stylesheet" type="text/css"
	href="/hrs-intranet/styles/jsgantt.css" />

<link type="text/css"
	href="/hrs-intranet/js/jquery/css/ui-lightness/jquery-ui-1.8.16.custom.css"
	rel="stylesheet" />
<script type="text/javascript"
	src="/hrs-intranet/js/jquery/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript"
	src="/hrs-intranet/js/jquery/js/jquery-ui-1.8.16.custom.min.js"></script>

</head>

<s:include value="errorsSection.jsp"></s:include>
<s:actionerror />
<s:fielderror />

<script type="text/javascript">
	
</script>

<s:form cssClass="formClass">

	<s:textfield name="filters.period" label="Period" readonly="true" />

	<sx:autocompleter list="allEmployeesList" listValue="person.name"
		searchType="startstring" listKey="id" showDownArrow="false"
		keyName="filters.selectedEmployeeId"
		name="filters.selectedEmployeeName" label="Employee" resultsLimit="-1" />

	<sx:autocompleter list="allRoleList" listValue="description"
		searchType="startstring" listKey="code" showDownArrow="false"
		keyName="filters.selectedRoleId" name="filters.selectedRoleName"
		label="Rol" resultsLimit="-1" />

	<sx:autocompleter list="allMentorsList" listValue="person.name"
		searchType="startstring" listKey="id" showDownArrow="false"
		keyName="filters.selectedMentorId" name="filters.selectedMentorName"
		label="Mentor" resultsLimit="-1" />

	<s:submit action="FeedbackFinalResultsAction_filter" key="Filter"
		cssClass="btn" id="okbtn" align="center" style="text-align: center" />

</s:form>


<s:if test="%{showReturn}">
	<s:a href="FeedbackPeriodsAction" cssClass="Add" cssStyle="position:relative; left:1000px;">Go to Manage Feedback Periods</s:a>
</s:if>


<display:table id="filteredFeedbackPeriods" name="feedbackPeriods"
	defaultsort="2" defaultorder="ascending"
	requestURI="FeedbackFinalResultsAction_filter" class="listable"
	cellpadding="0" cellspacing="0" pagesize="20">

	<display:caption media="html">
		<thead>
			<tr>
				<th colspan="6">Employee data</th>
				<th colspan="2" style="text-align: center;">Actual</th>
				<th colspan="5" style="text-align: center;">Performance</th>
				<th colspan="3" style="text-align: center;">Commitment</th>
				<th colspan="4" style="text-align: center;">HRS Calculation</th>
				<th colspan="2" style="text-align: center;">&nbsp;</th>
			</tr>
		</thead>
	</display:caption>
	
	<display:column property="employee.location.abbreviation" title="Of" sortable="true" />
	<display:column property="employee.person.name" title="Employee" sortable="true" />
	<display:column property="mentor.person.name" title="Mentor" sortable="true" />
	<display:column property="employee.dateStart" title="First W D" sortable="true" format="{0,date,dd/MM/yyyy}" />
	<display:column property="employee.firstEmployeeDate" title="RD" sortable="true" format="{0,date,dd/MM/yyyy}" />
	<display:column title= "Years" sortable="false"  style="text-align: center">
	<s:if test=" (#attr.filteredFeedbackPeriods.employee.getEmployeeeDependencyEndYearAntiquity(filters.period) <= 12 )
		&& (#attr.filteredFeedbackPeriods.employee.getEmployeeeDependencyEndYearAntiquity(filters.period) >= 5)  " >
			<font style="color: #418282;">
				<s:property value="#attr.filteredFeedbackPeriods.employee.getEmployeeEndYearAntiquity(filters.period)"/>
			</font>
		</s:if>
		<s:else>	
			<s:if test=" #attr.filteredFeedbackPeriods.employee.getEmployeeeDependencyEndYearAntiquity(filters.period) <5 " >
				<font style="color: #CC3333;">
					<s:property value="#attr.filteredFeedbackPeriods.employee.getEmployeeEndYearAntiquity(filters.period)"/>
				</font>
			</s:if>
			<s:else>
				<s:property value="#attr.filteredFeedbackPeriods.employee.getEmployeeEndYearAntiquity(filters.period)"/>
			</s:else>
		</s:else>
	</display:column>
	<display:column property="actualBand.description" title="Role"
		sortable="true" />
	<display:column property="actualPosition" title="Band"
		sortable="true" format="{0,number,00} %" style="text-align: center" />
	<display:column title="NAE"
		property="feedbacksDataSummary.scoreCountNAE"
		sortable="false" style="text-align: center" />
	<display:column title="ADE"
		property="feedbacksDataSummary.scoreCountADE"
		sortable="false" style="text-align: center" />
	<display:column title="AE"
		property="feedbacksDataSummary.scoreCountAE"
		sortable="false" style="text-align: center" />
	<display:column title="AEE"
		property="feedbacksDataSummary.scoreCountAEE"
		sortable="false" style="text-align: center" />
	<display:column title="EE"
		property="feedbacksDataSummary.scoreCountEE"
		sortable="false" style="text-align: center" />
	<display:column title="R"
		property="feedbacksDataSummary.effortCountRegular" sortable="false"
		style="text-align: center" />
	<display:column title="B"
		property="feedbacksDataSummary.effortCountBueno" sortable="false"
		style="text-align: center" />
	<display:column title="S"
		property="feedbacksDataSummary.effortCountSobresaliente"
		sortable="false" style="text-align: center" />
	<display:column title="Final perf."
		property="feedbacksDataSummary.hrsFinalScore" sortable="false" />
	<display:column title="Final comm."
		property="feedbacksDataSummary.hrsFinalEffort" sortable="false" />
	<display:column title="New role" property="newBand" sortable="false" />
	<display:column title="Band" property="newPosition" sortable="false"
		style="text-align: center" />
	<display:column title="Prom" property="promoted" sortable="false"
		style="text-align: center" />
	<display:column title="Outs" property="outstanding" sortable="false"
		style="text-align: center" />
</display:table>

<s:if test="%{feedbackPeriods.size != 0 && !isOpen()}">
	<table width="100%">
		<tr>
			<td width="50%" align="center">
				<table>
					<s:form action="FeedbackFinalResultsAction_export">
						<s:hidden name="filters.selectedEmployeeId"
							value="%{filters.selectedEmployeeId}" />
						<s:hidden name="filters.selectedEmployeeName"
							value="%{filters.selectedEmployeeName}" />
						<s:hidden name="filters.selectedRoleId"
							value="%{filters.selectedRoleId}" />
						<s:hidden name="filters.selectedRoleName"
							value="%{filters.selectedRoleName}" />
						<s:hidden name="filters.selectedMentorId"
							value="%{filters.selectedMentorId}" />
						<s:hidden name="filters.selectedMentorName"
							value="%{filters.selectedMentorName}" />
							
						<s:hidden name="canExport" value="%{canExport}"/>
	
						<s:submit key="Export" cssClass="btn" id="okbtn"
							style="text-align: center" />
					</s:form>
				</table>
			</td>
		</tr>
	</table>
</s:if>


